package com.zzyl.config;

import com.aliyun.iot20180120.Client;
import com.aliyun.teaopenapi.models.Config;
import com.zzyl.properties.AliIoTConfigProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author yangeit
 * @date 2024年05月23日 15:14
 * @Description
 */
@Configuration
public class AliIotConfig {


    @Autowired
    AliIoTConfigProperties aliIoTConfigProperties;


    @Bean
    public Client getClient() throws Exception {

        Config config = new Config()
                .setAccessKeyId(aliIoTConfigProperties.getAccessKeyId())
                // 您的AccessKey Secret
                .setAccessKeySecret(aliIoTConfigProperties.getAccessKeySecret());
// 访问的域名
        config.endpoint = "iot.cn-shanghai.aliyuncs.com";
//        config.regionId = aliIoTConfigProperties.getRegionId();
        Client client = new Client(config);
        return client;
    }







}
